<?php 
namespace Admin\Model;
use Think\Model;
class UserModel extends Model {
	/**
	 * [checkEmail 检测邮箱是否存在]
	 * @Author   Xuebingsi
	 * @DateTime 2017-03-28T10:19:29+0800
	 * @param    [type]                   $email [description]
	 * @return   [type]                          [description]
	 */
	public function checkEmail($email)
	{
		$res = $this->where("email='{$email}'")->find();

		// $sql  = "select * from user where email='{$email}'";

		// $res = $this->query($sql);


		return $res;
	}
	/**
	 * [checkNickname 检测昵称是否存在]
	 * @Author   Xuebingsi
	 * @DateTime 2017-03-28T10:19:11+0800
	 * @param    [type]                   $nickname [description]
	 * @return   [type]                             [description]
	 */
	public function checkNickname($nickname)
	{
		$res = $this->where("nickname='{$nickname}'")->find();

		return $res;
	}

	public function checkLogin($nickname,$password)
	{
		// $password = md5($password);
		
		// $sql ="select * from user where email='{$email}' and password= '{$password}'";

		// $this->query($sql);

		$data = array(
			'nickname'=>$nickname,
			'password'=>md5($password),
			'is_admin'=>'1'
			);
		return $this->where($data)->find();
	}

}


 ?>